﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	mc:Ignorable="d"
	x:Class="SurveySez.View.DashboardControl"
	x:Name="UserControl"
	d:DesignWidth="640" d:DesignHeight="480" FontSize="18.667">
	<UserControl.Resources>
		<DataTemplate x:Key="AnswerViewModelTemplate">
			<StackPanel>
				<TextBlock Text="{Binding Display}" Style="{DynamicResource AnswerStyle}"/>
			</StackPanel>
		</DataTemplate>
		<Style x:Key="AnswerStyle" TargetType="{x:Type TextBlock}">
			<Setter Property="TextWrapping" Value="NoWrap"/>
			<Setter Property="TextTrimming" Value="None"/>
			<Setter Property="Background" Value="White"/>
			<Style.Triggers>
				<DataTrigger Binding="{Binding IsPending}" Value="True">
					<Setter Property="Background" Value="#FF88FF88"/>
				</DataTrigger>
				<DataTrigger Binding="{Binding IsGuessed}" Value="True">
					<Setter Property="Background" Value="#FF8888FF"/>
				</DataTrigger>
			</Style.Triggers>
		</Style>
		<Style x:Key="VisibleWhenIncorrectIsPending" TargetType="TextBlock">
			<Setter Property="Visibility" Value="Collapsed"/>
			<Style.Triggers>
				<DataTrigger Binding="{Binding IsIncorrectPending}" Value="True">
					<Setter Property="Visibility" Value="Visible"/>
				</DataTrigger>
			</Style.Triggers>
		</Style>
	</UserControl.Resources>

	<Grid x:Name="LayoutRoot" d:DataContext="{d:DesignData /SampleData/DashboardViewModelSampleData.xaml}">
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="Auto"/>
			<ColumnDefinition Width="0.595*"/>
		</Grid.ColumnDefinitions>
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="0.941*"/>
		</Grid.RowDefinitions>
		<Label Content="Question:" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="5"/>
		<TextBlock TextWrapping="Wrap" Text="{Binding Question}" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="-0.001,0,0,0"/>
		<Label Content="Answers:" HorizontalAlignment="Left" Grid.Row="1" Margin="5" d:LayoutOverrides="Height"/>
		<ListBox Grid.Row="2" Grid.ColumnSpan="2" Margin="5,0,5,5" ItemTemplate="{DynamicResource AnswerViewModelTemplate}" ItemsSource="{Binding Answers}" HorizontalContentAlignment="Stretch"/>
		<TextBlock Grid.Column="1" HorizontalAlignment="Left" Margin="9,8,0,12" Grid.Row="1" TextWrapping="Wrap" Text="X" d:LayoutOverrides="Height" Foreground="#FFF50000" FontWeight="Bold" Style="{StaticResource VisibleWhenIncorrectIsPending}"/>
		<Button Content="End Game" Grid.Column="1" HorizontalAlignment="Right" Margin="0,0,8,0" Grid.Row="1" d:LayoutOverrides="Height" VerticalAlignment="Center" Command="{Binding EndGame}"/>
	</Grid>
</UserControl>